using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using webapp4U.BOL;

namespace webapp4U.UI.Control
{
    public partial class Newsletter : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btSave_Click(object sender, EventArgs e)
        {
            if (webapp4U.BOL.NewsLetter.CheckEmail(txtEmail.Text.Trim()) == false)
            {
                webapp4U.BOL.NewsLetter obj = new webapp4U.BOL.NewsLetter();
                obj.Company = "";
                obj.AddedDate = DateTime.Now;
                obj.Title = "";
                obj.FirstName = "";
                obj.LastName = "";
                obj.Email = txtEmail.Text.Trim();
                webapp4U.BOL.NewsLetter.Insert(obj);
                txtEmail.Text = "";
                Response.Write("<script> alert('" + ResourceManager.GetString("Newsletter_DangkyThanhcong") + "') </script>");
            }
            else
            {
                Response.Write("<script> alert('" + ResourceManager.GetString("Newsletter_DaTonTai") + "') </script>");
            }
        }
}
}